<template>
    <span>
        <el-tabs v-bind="$attrs"  v-model="activeTab" @tab-change="handleClick">
            <el-tab-pane v-if="$attrs.showAll" :label="$attrs.allLabel" name="__first__"></el-tab-pane>
            <el-tab-pane v-for="item in $attrs.fields" :key="item.name" :label="item.label" :name="item.name"></el-tab-pane>
        </el-tabs>
    </span>
</template>

<script setup>
import { defineEmits, ref,useAttrs } from "vue";
const activeTab = ref("__first__");
const emit = defineEmits(['change']);
const handleClick = (val) => {
    emit('change', val=='__first__'?"":val)
};

</script>

<style></style>